//
//  NSString+YCRichText.h
//  YCBaseModule
//
//  Created by Apple on 2022/11/1.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSString (YCRichText)

/// 创建富文本并配置富文本(NSArray中的数据必须是ConfigAttributedString对象合集)
- (NSMutableAttributedString *)createAttributedStringAndConfig:(NSArray *)configs;

/// 用于搜寻一段字符串在另外一段字符串中的NSRange值
- (NSRange)rangeFrom:(NSString *)string;

/// 本字符串的range
- (NSRange)range;

/// 创建富文本
/// @param textColor 默认文字颜色
/// @param textFont 默认字体
/// @param optionString 需要改变文本
/// @param optionFont 文本字体
/// @param optionColor 文本颜色
- (NSMutableAttributedString *)attributedStringColor:(UIColor *_Nullable)textColor
                                                Font:(UIFont *_Nonnull)textFont
                                        OptionString:(NSString *_Nonnull)optionString
                                          OptionFont:(UIFont *_Nullable)optionFont
                                     foregroundColor:(UIColor *_Nonnull)optionColor;

/// 带行间距的可选富文本
/// @param textColor textColor description
/// @param textFont textFont description
/// @param optionString optionString description
/// @param optionFont optionFont description
/// @param optionColor optionColor description
/// @param spacing spacing description
- (NSMutableAttributedString *)attributedStringColor:(nullable UIColor *)textColor
                                                Font:(UIFont *)textFont
                                        OptionString:(NSString *)optionString
                                          OptionFont:(nullable UIFont *)optionFont
                                     foregroundColor:(UIColor *)optionColor
                                         lineSpacing:(CGFloat)spacing;

/// 转成NSMutableAttributedString
/// - Parameters:
///   - font: 文字大小
///   - lineSpacing: 间隙
- (NSMutableAttributedString *)attributedStringFont:(UIFont *)font
                                            spacing:(CGFloat)spacing;

/// 转成NSMutableAttributedString
/// @param font 文字大小
/// @param spacing 间隙
/// @param textAlignment 对齐方式
- (NSMutableAttributedString *)attributedStringFont:(UIFont *)font
                                            spacing:(CGFloat)spacing
                                      textAlignment:(NSTextAlignment)textAlignment;

@end

NS_ASSUME_NONNULL_END
